package com.itheima_06;

import java.util.Scanner;

public class StringLoginDemo1 {
    public static void main(String[] args) {
        String usrname = "zhangsan";
        String password = "123456";
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 3; i++) {
            System.out.println("请您输入用户名");
            String name = sc.nextLine();
            System.out.println("请您输入密码");
            String pwd = sc.nextLine();
            if (usrname.equals(name) && password.equals(pwd)) {
                System.out.println("欢迎您,登录成功");
                break;
            } else {
                if(2 - i == 0){
                    System.out.println("您的账号已经锁定,请您联系客服");
                }else{
                    System.out.println("登录失败,还有" + (2 - i) + "次机会");
                }
            }
        }
    }
}
